home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 September / september_2000.iso / intercd / root / ^Linux / cdrtools-1.10 / include / waitdefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-11-14  |  2.4 KB  |  96 lines

  1. /* @(#)waitdefs.h    1.7 99/11/14 Copyright 1995 J. Schilling */
  2. /*
  3.  *    Definitions to deal with various kinds of wait flavour
  4.  *
  5.  *    Copyright (c) 1995 J. Schilling
  6.  */
  7. /*
  8.  * This program is free software; you can redistribute it and/or modify
  9.  * it under the terms of the GNU General Public License as published by
  10.  * the Free Software Foundation; either version 2, or (at your option)
  11.  * any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; see the file COPYING.  If not, write to
  20.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23. #ifndef    _WAITDEFS_H
  24. #define    _WAITDEFS_H
  25.  
  26. #ifndef _MCONFIG_H
  27. #include <mconfig.h>
  28. #endif
  29.  
  30. #if    defined(HAVE_WAIT_H)
  31. #    include <wait.h>
  32. #else
  33. /*
  34.  * K&R Compiler doesn't like #elif
  35.  */
  36. #    if    defined(HAVE_SYS_WAIT_H)    /* POSIX.1 compat sys/wait.h */
  37. #    undef    HAVE_UNION_WAIT            /* POSIX.1 doesn't use U_W   */
  38. #        include <sys/wait.h>
  39. #    endif
  40. #endif
  41.  
  42. #ifdef HAVE_UNION_WAIT
  43. #    define WAIT_T union wait
  44. #    ifndef WTERMSIG
  45. #        define WTERMSIG(status)        ((status).w_termsig)
  46. #    endif
  47. #    ifndef WCOREDUMP
  48. #        define WCOREDUMP(status)    ((status).w_coredump)
  49. #    endif
  50. #    ifndef WEXITSTATUS
  51. #        define WEXITSTATUS(status)    ((status).w_retcode)
  52. #    endif
  53. #    ifndef WSTOPSIG
  54. #        define WSTOPSIG(status)        ((status).w_stopsig)
  55. #    endif
  56. #else
  57. #    define WAIT_T int
  58. #    ifndef WTERMSIG
  59. #        define WTERMSIG(status)        ((status) & 0x7F)
  60. #    endif
  61. #    ifndef WCOREDUMP
  62. #        define WCOREDUMP(status)    ((status) & 0x80)
  63. #    endif
  64. #    ifndef WEXITSTATUS
  65. #        define WEXITSTATUS(status)    (((status) >> 8) & 0xFF)
  66. #    endif
  67. #    ifndef WSTOPSIG
  68. #        define WSTOPSIG(status)        (((status) >> 8) & 0xFF)
  69. #    endif
  70. #endif
  71.  
  72. #ifndef WIFSTOPPED
  73. #    define    WIFSTOPPED(status)    (((status) & 0xFF) == 0x7F)
  74. #endif
  75. #ifndef WIFSIGNALED
  76. #    define    WIFSIGNALED(status)    (((status) & 0xFF) != 0x7F && \
  77.                         WTERMSIG(status) != 0)
  78. #endif
  79. #ifndef WIFEXITED
  80. #    define    WIFEXITED(status)    (((status) & 0xFF) == 0)
  81. #endif
  82.  
  83. #ifndef    WCOREFLG
  84. #define    WCOREFLG    0x80
  85. #endif
  86.  
  87. #ifndef    WSTOPFLG
  88. #define    WSTOPFLG    0x7F
  89. #endif
  90.  
  91. #ifndef    WCONTFLG
  92. #define    WCONTFLG    0xFFFF
  93. #endif
  94.  
  95. #endif    /* _WAITDEFS_H */
  96.